package com.cnblogs.hoojo.main;

import cn.org.rapid_framework.generator.Generator;
import cn.org.rapid_framework.generator.GeneratorFacade;

/**
 * <b>function:</b> 代码生成器主函数
 * @author hoojo
 * @createDate 2017-6-9 下午2:17:26
 * @file GeneratorCodeMain.java
 * @package com.cnblogs.hoojo.main
 * @project RapidFramework
 * @blog http://blog.csdn.net/IBM_hoojo
 * @email hoojo_@126.com
 * @version 1.0
 */
public class GeneratorCodeMain {

	public static void main(String[] args) throws Exception {
		
		//new GeneratorTableListeners();
		
		// 显示所有数据库表
		//GeneratorFacade.printAllTableNames();

		GeneratorFacade facade = new GeneratorFacade();
		
		Generator generator = facade.getGenerator();
		generator.setSourceEncoding("UTF-8");
		generator.setOutputEncoding("UTF-8");
		
		// 删除代码输出目录
		facade.deleteOutRootDir();
		
		// 设置指定模板根目录
		//generator.setTemplateRootDir("templates");
		generator.setTemplateRootDir("masget-templates");
		
		// 生成指定table的代码
		//facade.generateByTable("ups_merchant_profit");
		//facade.generateByTable("ups_merchant_daily_profit");
		//facade.generateByTable("ups_merchant_monthly_profit");
		
		//facade.generateByTable("ups_merchant_daily_amount");
		//facade.generateByTable("ups_merchant_daily_compare");
		
		//facade.generateByTable("ups_merchant_weekly_amount");
		//facade.generateByTable("ups_merchant_weekly_compare");
		
		//facade.generateByTable("ups_person_performance_daily");
		//facade.generateByTable("ups_person_performance_monthly");
		
		//facade.generateByTable("areacode");
		facade.generateByTable("companycredit");
		
		
		// 删除生成代码
		//facade.deleteByTable("user");
		
		//Runtime.getRuntime().exec("cmd.exe /c start " + GeneratorProperties.getRequiredProperty("outRoot").replace('/', '\\'));
	}
}
